<?php
require_once(PATH_TO_APP . "/components/gismap/GisMap.php");
require_once(PATH_TO_APP . "/components/maplist/MapList.php");
require_once(PATH_TO_APP . "/components/tabledatagateway/GisMapGateway.php");

class InputMapper
{  
    
    private $gismap_;
    private $request_;
    private $session_;
    private $singleton_registry_;
    private $language_handler_;
    private $output_handler_;
    private $table_gateway_;
    private $is_wms_;
    private $map_list_;

    public function __construct($is_wms, $table_gateway, $singleton_registry)
    {
        $this->table_gateway_ = $table_gateway;
        $this->is_wms_ = $is_wms;
        $this->output_handler_ = $singleton_registry->getSingleton('OutputHandler');
        $this->request_ = $singleton_registry->getSingleton('Request');
        $this->session_ = $singleton_registry->getSingleton('Session');
        $this->language_handler_ = $singleton_registry->getSingleton('LanguageHandler');
        $this->singleton_registry_ = $singleton_registry;
        $this->map_list_ = new MapList();
        $this->map_list_->set('map_label', constant("self::MAP_LABEL_REGION"));
        $this->map_list_->set('start_color', constant("self::CLASS_START_COLOR")); 
        $this->map_list_->set('end_color', constant("self::CLASS_END_COLOR"));
        $this->map_list_->set('base_color', constant("self::CLASS_BASE_COLOR"));
        $this->map_list_->set('class_width', constant("self::CLASS_WIDTH"));
        $this->map_list_->set('class_method', constant("self::CLASSIFICATION_EQUAL"));
        $this->map_list_->set('layer_opacity', constant("self::LAYER_OPACITY"));
        $this->map_list_->set('cases_datatype', constant("self::CASES_DATATYPE_INT"));
        $this->map_list_->set('border_color', constant("self::BORDER_COLOR"));
        $this->map_list_->set('map_fontsize_label', constant("self::MAP_FONTSIZE_LABEL_DEFAULT"));
    }
        
    public function __destruct(){}
    
    public function checkInput()
    {
        if($this->request_->issetParameter('get', 'REQUEST') && (strtolower($this->request_->getParameter('get', 'REQUEST')) == strtolower(constant("self::WMS_REQUEST_CAPABILITIES")) || strtolower($this->request_->getParameter('get', 'REQUEST')) == strtolower(constant("self::WMS_REQUEST_LEGEND"))))
        {
            $this->gismap_->wmsRequest();
            return true;
        }
    }
    
}

?>
